<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>新品有戏合作平台注册</title>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/boot.css">
    <style type="text/css">
        .login{width:400px;margin: 0 auto;margin-top: 200px;}
        .login .panel-title{text-align: center;}
        .input-group{margin-bottom: 20px}
        .code-text{width: 240px;float: left;}
        .code-img{float: right;border: 1px solid #ccc;margin: 1px 10px 0 0;}
        .footer{line-height: 35px;width: 300px;margin: 0 auto;margin-top:10px;border-radius:10px;background: rgba(50,50,50,0.6);color:#fff;}
    </style>
</head>
<body>
<div class="panel panel-default login">
    <div class="panel-heading">
        <h3 class="panel-title">新品有戏商家合作平台注册</h3>
    </div>
    <div class="panel-body">
        <label style="display: none;color: red;text-align: center" id="info"></label>
        <form action="" method="post" onsubmit="return false" id="checklogin">
            <div class="input-group">
                <span class="input-group-addon" ><i class="fa fa-user-circle-o"></i> 邮　箱&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <input type="text" name="email" onblur="verificationuser()" placeholder="请输入邮箱" id="username" class="form-control" aria-describedby="sizing-addon2">
            </div>
            <div class="input-group">
                <span class="input-group-addon" ><i class="fa fa-key"></i> 密　码&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <input type="password"  name="password" onblur="verificationpassword()" placeholder="密码由6-20位字母，数字" class="form-control" aria-describedby="sizing-addon2" >
            </div>
            <div class="input-group">
                <span class="input-group-addon" ><i class="fa fa-key"></i> 确认密码</span>
                <input type="password"  name="pass" onblur="verificationpass()" class="form-control" aria-describedby="sizing-addon2">
            </div>
            <div class="input-group">
                <span class="input-group-addon" ><i class="fa fa-user-circle-o"></i> 付款方式</span>
                <div class="layui-input-block" style="margin-left: 5px">
                    <input type="radio" name="successively" value="1" >一件代发
                    <input type="radio" name="successively" value="2" > 寄售
                </div>
            </div>
            <div class="input-group code-text">
                <span class="input-group-addon" id=""><i class="fa fa-barcode"></i> 验证码&nbsp;&nbsp;&nbsp;&nbsp;</span>
                <input type="password" id="code" name="code" class="form-control" aria-describedby="sizing-addon2">
            </div>
            <div class="code-img">
                <img src="{:url('business/register/registercode')}" id="imgs" onclick="this.src='{:url(\'business/register/registercode\')}?id='+Math.random()" width="80px" height="30px" alt="" >
            </div>
            <!-- 清除浮动，一删就乱！！！！！！！！ -->

            <div style="width: 250px;margin: 0 auto">
                <div style="width: 100px;float: left">
                    <button type="submit" id="register"  style="width: 100px;float: left" class="btn btn-primary btn-block"><i class="fa fa-sign-in"></i> 注 册</button>
                </div>
                <div style="width: 100px;float: right">
                <button type="submit" id="resend"  style="width: 150px;" class="btn btn-default btn-block"><i class="fa fa-sign-in"></i> 发送失败?点击重发送 </button>
            </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="__STATIC__/login/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script>
    //对登录框的位置进行计算
    $(".login").css("margin-top",($(document).height()/2) - ($('.login').height()/2)-50);
    $("#login").click(function () {
       window.location.href = "{:url('business/login/index')}";
    });
    $("#resend").click(function () {
        var email = $("input[name=email]").val();
        if(!email){
            $("#info").html('请输入邮箱');
            $("#info").css('display','block');
            return ;
        }
        var password = $("input[name=password]").val();
        if(!password){
            $("#info").html('请输入密码');
            $("#info").css('display','block');
            return ;
        }
        var pass = $("input[name=pass]").val();
        if(!pass){
            $("#info").html('确认密码不能为空');
            $("#info").css('display','block');
            return ;
        }
        var code = $("input[name=code]").val();
        if(!code){
            $("#info").html('请输入验证码');
            $("#info").css('display','block');
            return ;
        }
        var radio = $("input[name=successively]:checked").val();
        if(!radio){
            $("#info").html('请输入付款方式');
            $("#info").css('display','block');
            return ;
        }
        $.ajax({
            url:"{:url('business/register/resend')}",
            data:$("#checklogin").serialize(),
            type:"post",
            dataType:"json",
            success:function (res) {
                if(res.success){
                    layer.alert(res.success);
                }
            }
        });
    })
</script>
{include file="register/verification" /}

</html>